Skip to content

chore(main): release 6.17.0 #4552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2025

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Jun 3, 2025

🌱 A new release!

6.17.0 (2025-06-03)

The MongoDB Node.js team is pleased to announce version 6.17.0 of the mongodb package!

Release Notes

Support for MongoDB 4.0 is removed

Warning

When the driver connects to a MongoDB server of version 4.0 or less, it will now throw an error.

OIDC machine workflows now retry on token expired errors during initial authentication

This resolves issues of a cached OIDC token in the driver causing initial authentication to fail when the token had expired. The affected environments were "azure", "gcp", and "k8s".

keepAliveInitialDelay may now be configured at the MongoClient level

When not present will default to 120 seconds. The option value must be specified in milliseconds.

import { MongoClient } from 'mongodb';

const client = new MongoClient(process.env.MONGODB_URI, { keepAliveInitialDelay: 100000 });

updateOne and replaceOne now support a sort option

The updateOne and replaceOne operations in each of the ways they can be performed support a sort option starting in MongoDB 8.0. The driver now supports the sort option the same way it does for find or findOneAndModify-style commands:

const sort = { fieldName: -1 };

collection.updateOne({}, {}, { sort });
collection.replaceOne({}, {}, { sort }); 

collection.bulkWrite([ 
  { updateOne: { filter: {}, update: {}, sort } },
  { replaceOne: { filter: {}, replacement: {}, sort } },
]);

client.bulkWrite([
  { name: 'updateOne', namespace: 'db.test', filter: {}, update: {}, sort },
  { name: 'replaceOne', namespace: 'db.test', filter: {}, replacement: {}, sort }
]);

MongoClient close shuts outstanding in-use connections

The MongoClient.close() method now shuts connections that are in-use allowing the event loop to close if the only remaining resource was the MongoClient.

Support Added for Configuring the DEK cache expiration time.

Default value is 60000. Requires using mongodb-client-encryption >= 6.4.0

For ClientEncryption:

import { MongoClient, ClientEncryption } from 'mongodb';
const client = new MongoClient(process.env.MONGODB_URI);
const clientEncryption = new ClientEncryption(client, { keyExpirationMS: 100000, kmsProviders: ... });

For auto encryption:

import { MongoClient, ClientEncryption } from 'mongodb';
const client = new MongoClient(process.env.MONGODB_URI, {
  autoEncryption: {
    keyExpirationMS: 100000,
    kmsProviders: ...
  }
});

Update operations will now throw if ignoreUndefined is true and all operations are undefined.

When using any of the following operations they will now throw if all atomic operations in the update are undefined and the ignoreUndefined option is true. This is to avoid accidental replacement of the entire document with an empty document. Examples of this scenario:

import { MongoClient } from 'mongodb';

const client = new MongoClient(process.env.MONGODB_URI);

client.bulkWrite(
  [
    {
      name: 'updateMany',
      namespace: 'foo.bar',
      filter: { age: { $lte: 5 } },
      update: { $set: undefined, $unset: undefined }
    }
  ],
  { ignoreUndefined: true }
);

const collection = client.db('test').collection('test');

collection.bulkWrite(
  [
    {
      updateMany: {
        filter: { age: { $lte: 5 } },
        update: { $set: undefined, $unset: undefined }
      }
    }
  ],
  { ignoreUndefined: true }
);

collection.findOneAndUpdate(
  { a: 1 },
  { $set: undefined, $unset: undefined },
  { ignoreUndefined: true }
);

collection.updateOne({ a: 1 }, { $set: undefined, $unset: undefined }, { ignoreUndefined: true });

collection.updateMany({ a: 1 }, { $set: undefined, $unset: undefined }, { ignoreUndefined: true });

Socket errors are always treated as network errors

Network errors perform an important role in the driver, impacting topology monitoring processes and retryablity. A bug in the driver's socket implementation meant that in scenarios where server disconnects occurred while no operation was in progress on the socket resulted in errors that were not considered network errors.

Socket errors are now unconditionally treated as network errors.

Features

Bug Fixes

Documentation

We invite you to try the mongodb library immediately, and report any issues to the NODE project.


@durran
Copy link
Member

durran commented Jun 3, 2025

run release_notes

@durran durran merged commit 56b2e6d into main Jun 3, 2025
26 of 28 checks passed
@durran durran deleted the release-please--branches--main--components--mongodb branch June 3, 2025 19:00
Copy link
Contributor Author

github-actions bot commented Jun 3, 2025

🤖 Created releases:

🌻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant